﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LPV_POS;
using System.Data;
using CrystalDecisions.CrystalReports.Engine;


    public class Mod_header_report
    {
        thuvien tv;
        DataTable tb;
        string[] s;
        object[] o;

       public DataTable f_selectheaderreport()
        {
            s = new string[] {"@flag" };
            o = new object[] {1 };
            tv = new thuvien();
            tb = tv.SP_SelectDataTable("sp_header_report", s, o);
            return tb;
        }
       public void f_header_report(ReportDocument rpt)
           {
               try
               {

                   tb = f_selectheaderreport();

                   CrystalDecisions.CrystalReports.Engine.TextObject str_tencongty;
                   str_tencongty = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt.ReportDefinition.ReportObjects["txt_tencongty"];

                   CrystalDecisions.CrystalReports.Engine.TextObject str_dienthoai;
                   str_dienthoai = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt.ReportDefinition.ReportObjects["txt_dienthoaicongty"];

                   CrystalDecisions.CrystalReports.Engine.TextObject str_diachi;
                   str_diachi = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt.ReportDefinition.ReportObjects["txt_diachicongty"];

                   if (tb.Rows.Count > 0)
                   {
                       str_tencongty.Text = tb.Rows[0]["HEADER"] + "";
                       str_dienthoai.Text = tb.Rows[0]["PHONE"] + "";
                       str_diachi.Text = tb.Rows[0]["ADDRESS"] + "";
                   }
                   else
                   {
                       str_tencongty.Text = "";
                       str_dienthoai.Text = "";
                       str_diachi.Text = "";
                   }
               }
               catch (Exception ex)
               {
                   string s = ex.Message;
               }
           }
    }

